package ac.github.os.internal.core.script;

import ac.github.os.internal.core.trigger.Trigger;
import ac.github.os.util.GenericsUtils;
import ac.github.os.util.UtilKt;
import org.bukkit.entity.Entity;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public abstract class JavaInternalScript<T extends BaseWrapper> implements InternalScript<T> {

    @Nullable
    @Override
    abstract public String execute(@Nullable Trigger trigger, @NotNull T wrapper, @NotNull InternalConfig config, @NotNull String string);

    @NotNull
    @Override
    abstract public String getName();

    @Override
    public Class<?> getGenericType() {
        return GenericsUtils.getSuperClassGenricType(this.getClass());
    }

    @Override
    public void register() {
        InternalScriptManager.INSTANCE.getInternalScripts().add(this);
    }
}
